package com.qf.controller;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    @RequestMapping(value = "/send")
    public void send(String msg){
        System.out.println("发送消息给业务交换机= [" + msg + "]");
        ;rabbitTemplate.convertAndSend("user-exchange","user.add",msg);
    }
}
